from pyspark import SparkConf,SparkContext

words = 'this is a letter for john, which describle a girl loves him this is a letter how are you'.split()

sf = SparkConf().setMaster('spark://127.0.0.1:7077').setAppName('my1')
sc = SparkContext(conf=sf)

rdd = sc.parallelize(words).collect()
for i in range(len(rdd)):
    for j in range(len(rdd)):
        if j > i:
            print(rdd[i],rdd[j])

sc.stop()
